<html>
<head><meta charset="utf-8"><title>Importing local modules in an evcxr Jupyter Notebook · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Importing.20local.20modules.20in.20an.20evcxr.20Jupyter.20Notebook.html">Importing local modules in an evcxr Jupyter Notebook</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="210774972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Importing%20local%20modules%20in%20an%20evcxr%20Jupyter%20Notebook/near/210774972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Duncan Gibbs <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Importing.20local.20modules.20in.20an.20evcxr.20Jupyter.20Notebook.html#210774972">(Sep 21 2020 at 17:40)</a>:</h4>
<p>Hello all. New to Zulip, so I apologize if I'm messing something up. I'm new to Jupyter Notebook and evcxr as well. Let's say I have a struct in a <code>src/models/goodreads.rs</code> file:</p>
<div class="codehilite"><pre><span></span><code>use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, Debug)]
pub struct Book {
    pub title: String,
    pub author: String,
    pub rating: f32,
    pub num_ratings: u64,
    pub year_published: u32,
}
</code></pre></div>


<p>How do I <code>use</code> that struct in a Jupyter Notebook? Obviously, if I were in another file, I would just do:</p>
<div class="codehilite"><pre><span></span><code>use crate::models::goodreads::Book;
</code></pre></div>


<p>But that doesn't work in a Jupyter Notebook.</p>
<p>I really appreciate the help! I've been hitting my head against this for a while.</p>



<a name="210775378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Importing%20local%20modules%20in%20an%20evcxr%20Jupyter%20Notebook/near/210775378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pachi <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Importing.20local.20modules.20in.20an.20evcxr.20Jupyter.20Notebook.html#210775378">(Sep 21 2020 at 17:43)</a>:</h4>
<p>Hi <span class="user-mention" data-user-id="344905">@Duncan Gibbs</span> ! This zulip instance is mostly oriented to the development of the Rust language and tools. I think you could be more lucky trying in the community discord server. There, you even have a science and ai room <a href="https://discord.gg/DnT5s8">https://discord.gg/DnT5s8</a></p>



<a name="210775600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Importing%20local%20modules%20in%20an%20evcxr%20Jupyter%20Notebook/near/210775600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pachi <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Importing.20local.20modules.20in.20an.20evcxr.20Jupyter.20Notebook.html#210775600">(Sep 21 2020 at 17:45)</a>:</h4>
<p>Also, have you had a look to the series by Shahin Rostami in <a href="https://datacrayon.com/">https://datacrayon.com/</a> (search for Data Analysis with Rust Notebooks)?</p>



<a name="210775986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Importing%20local%20modules%20in%20an%20evcxr%20Jupyter%20Notebook/near/210775986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Duncan Gibbs <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Importing.20local.20modules.20in.20an.20evcxr.20Jupyter.20Notebook.html#210775986">(Sep 21 2020 at 17:48)</a>:</h4>
<p>I think I must have hopped on the wrong Discord earlier because it led me to here haha. Thanks for the help.</p>
<p>I hadn't looked at that specific series but I've been following a lot of interactive notebooks. Those all generate their code in the notebook, which makes sense if you're guiding someone. I'll check that one out though and see if it doesn't help. Cheers.</p>



<a name="210776224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Importing%20local%20modules%20in%20an%20evcxr%20Jupyter%20Notebook/near/210776224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Importing.20local.20modules.20in.20an.20evcxr.20Jupyter.20Notebook.html#210776224">(Sep 21 2020 at 17:50)</a>:</h4>
<p>It's totally fine to ask questions on here</p>



<a name="210776319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Importing%20local%20modules%20in%20an%20evcxr%20Jupyter%20Notebook/near/210776319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Importing.20local.20modules.20in.20an.20evcxr.20Jupyter.20Notebook.html#210776319">(Sep 21 2020 at 17:51)</a>:</h4>
<p>I think it's more of a "you might not find the same quality of responses here"</p>



<a name="210779400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Importing%20local%20modules%20in%20an%20evcxr%20Jupyter%20Notebook/near/210779400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pachi <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Importing.20local.20modules.20in.20an.20evcxr.20Jupyter.20Notebook.html#210779400">(Sep 21 2020 at 18:14)</a>:</h4>
<p>Yes, it's mostly that you probably can find more people that could help in other places</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>